package org.demo.filemanager.widget.xml;

import java.io.File;

import org.boxlayout.gui.BoxLayoutEngine;
import org.boxlayout.gui.layout.LayoutFactory;
import org.boxlayout.gui.type.ColorEnum;
import org.boxlayout.gui.widget.TreeBrowsable;

public class XmlFileWidget extends XmlNodeWidget{

	
	public XmlFileWidget(BoxLayoutEngine ble, String path) {		
		super(ble,  DomManager.loadFile(path).getDocumentElement());
		name = (new File(path)).getName();		
	}
	
	public TreeBrowsable initVisual() {
		//System.out.println("FileWidget init begin");
		color = defaultColor;
		nameContainer = ble.createElement()
		.setColor(color).setColor2(ColorEnum.LIGHTGRAY)
		.setPadding(0.05f).setText(name)
		.setId(name.hashCode());
		
		visual = ble.createElement().setLayout(LayoutFactory.getInstance().getVerticalLayout())
		.setPadding(0.00f).setColor(ColorEnum.WHITE);
		visual.add(nameContainer);
		//System.out.println("FileWidget init end");
		return this;
	}
	
	
}
